package com.itheima.springbootwebbtalis.mapper;

import com.itheima.springbootwebbtalis.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    //1.定义持久层方法
    //2.绑定SQL语句
    //查询所有信息
    @Select("select * from dept")
    List<Dept> deptMapperShowAll();
    // 根据id来删除
     @Delete("delete from dept where id=#{id}")
    void deptMapperRemove(Integer id);
     // 添加
    @Insert("insert into dept (id, name, create_time, update_time) values (null,#{name},#{createTime},#{updateTime});")
    void deptMapperAdd(Dept dept);
     @Select("select * from dept where id=#{id};")
   Dept deptMapperShowById(Integer id);
     @Update("update dept set name = #{name},update_time=#{updateTime}  where id =#{id};")
    void update(Dept dept);
}
